const OrderDirection = {
  SELL: "sell",
  BUY: "buy",
  getOtherSide(direct) {
    return direct === OrderDirection.SELL
      ? OrderDirection.BUY
      : OrderDirection.SELL;
  },
};

const OrderDirectionDesc = {
  [OrderDirection.BUY]: "多单",
  [OrderDirection.SELL]: "多空",
};

const PositionSide = {
  [OrderDirection.BUY]: "LONG",
  [OrderDirection.SELL]: "SHORT",
};

const OrderDirectionFactor = {
  [OrderDirection.BUY]: -1,
  [OrderDirection.SELL]: 1,
};

const LogType = {
  MAIN: "main",
  SUB: "sub",
  ORDER: "order",
};

const StoreName = {
  DUAL_ORDER_INFO: "dual-order-info",
  OPEN_ORDER_INFO: "open-order-info",
  LAST_LOSS_INFO: "last-loss-info",
  BOLL_STATUS_LIST: "boll-status-record-list",
  HOLDING_ORDER_BOLL_STATUS: "holding_order_boll_status",
  HOLDING_ORDER_BTC_QUANTITY: "holding_order_btc_quantity",
  OPEN_ORDER_TIMESTAMP: "open_order_timestamp",
  HOLDING_ORDER_DIRECTION: "holding_order_direction",
  BUILD_LIST: "build_list",
  PROTECT_ORDER_ID: "protect_order_id",
  PROTECT_ORDER_INDEX: "protect_order_index",
};
// 震荡
const _SHAKE = "shake";
// 收窄
const _NARROW = "narrow";
// 单边上涨
const _ONESIDEUP = "oneSideUp";
// 单边下跌
const _ONESIDEDOWN = "oneSideDown";
const BollStatus = {
  NORMAL: _SHAKE,
  SHAKE: _SHAKE,
  NARROW: _NARROW,
  ONESIDEUP: _ONESIDEUP,
  ONESIDEDOWN: _ONESIDEDOWN,
};

const BollStatusChangeDesc = {
  [`${_SHAKE}_TO_${_NARROW}`]: "布林状态变化：震荡行情 -> 收窄",
  [`${_NARROW}_TO_${_ONESIDEUP}`]: "布林状态变化：收窄 -> 单边上涨",
  [`${_NARROW}_TO_${_ONESIDEDOWN}`]: "布林状态变化：收窄 -> 单边下跌",
  [`${_ONESIDEUP}_TO_${_SHAKE}`]: "布林状态变化：单边上涨 -> 收窄",
  [`${_ONESIDEDOWN}_TO_${_SHAKE}`]: "布林状态变化：单边下跌 -> 收窄",
};

const OrderType = {
  LIMIT: "limit",
  STOP: "stop",
  TAKE_PROFIT: "take_profit",
};

const OrderTypeUpper = {
  LIMIT: "LIMIT",
  STOP: "STOP",
  TAKE_PROFIT: "TAKE_PROFIT",
};

const OrderStatus = {
  NEW: "NEW", // 新建订单
  PARTIALLY_FILLED: "PARTIALLY_FILLED", // 部分成交
  FILLED: "FILLED", // 全部成交
  CANCELED: "CANCELED", // 已撤销
  REJECTED: "REJECTED", // 订单被拒绝
  EXPIRED: "EXPIRED", // 订单过期(根据timeInForce参数规则)
};

const BuildConfig = {
  BUILD_NUM: 13, // 建仓数量
  STOP_GAP: 20,
  STOP_TRIGGER_GAP: 20,
};

const XFactorIndex = 1.88
const XFactorOpen = 1.5
const XFactorNomal = 0.4

const Symbol = 'BTCUSDT'


module.exports = {
  OrderDirection,
  LogType,
  StoreName,
  BollStatus,
  BollStatusChangeDesc,
  OrderType,
  OrderTypeUpper,
  OrderDirectionDesc,
  OrderDirectionFactor,
  PositionSide,
  OrderStatus,
  BuildConfig,
  XFactorIndex,
  XFactorOpen,
  XFactorNomal,
  Symbol
};
